package com.hzwq.mds.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
//import org.springframework.web.bind.annotation.RestController;

import com.hzwq.mds.exception.MyException;

//@RestController // 该注解使controller中所有返回都为json格式
@Controller
@RequestMapping("")
public class MyController {

     @ResponseBody
    @RequestMapping("/exceptionHandler")
    public String test(){
        if(true)
            throw new MyException(100, "自定义异常");
        return "welcome";
    }

}

